/**
 * Created by JetBrains WebStorm.
 * User: user
 * Date: 6/27/12
 * Time: 9:15 PM
 * To change this template use File | Settings | File Templates.
 */
//Execute the function when window load
$(window).bind("load", function() {

       //setup the height and position for your sticky footer
            footerHeight = 0,
           footerTop = 0,
           $footer = $("#footer");

       positionFooter();

       function positionFooter() {

                footerHeight = $footer.height();
                footerTop = ($(window).scrollTop()+$(window).height()-footerHeight)+"px";

               if ( ($(document.body).height()+footerHeight) < $(window).height()) {
                   $footer.css({
                        position: "absolute"
                   }).animate({
                        top: footerTop
                   })
               } else {
                   $footer.css({
                        position: "static"
                   })
               }

       }

       $(window).scroll(positionFooter)
               .resize(positionFooter)

})